import 'package:flutter/material.dart';
import 'package:xindong/widgets/common/xindong_common_widget.dart';
import 'package:xindong/widgets/video/xindong_common_video_list_ctr.dart';
import 'package:xindong/widgets/video/xindong_common_video_player_progress_control.dart';

// 全屏播放器
class XinDongCommonVideoPlayerFullScreenYeMian extends StatelessWidget {
  final String videoHeroKey;

  const XinDongCommonVideoPlayerFullScreenYeMian({Key? key, required this.videoHeroKey}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final videoController = XinDongCommonVideoListCtr.to;
    final double statusBarHeight = MediaQuery.of(context).padding.top;
    return Scaffold(
      backgroundColor: Colors.black,
      body: GestureDetector(
        onTap: () => videoController.xindong_onExitFullScreen(context),
        onPanEnd: (DragEndDetails details) => videoController.xindong_onExitFullScreen(context),
        behavior: HitTestBehavior.opaque,
        child: Stack(
          fit: StackFit.expand,
          alignment: Alignment.center,
          children: [
            /// 全屏视频层
            videoController.fullScreenPlayerView(videoHeroKey),

            /// 进度条
            Positioned(
              left: 0,
              right: 0,
              bottom: 0,
              height: 2.5,
              child: XinDongCommonVideoPlayerProgressControl(videoPlayerController: videoController.fullScreenVideoPlayerController),
            ),

            /// 关闭按钮
            Positioned(
              left: 12,
              top: statusBarHeight,
              child: videoPlayerCloseButton(onPressed: () => videoController.xindong_onExitFullScreen(context)),
            ),
          ],
        ),
      ),
    );
  }
}
